function [lb, ub, dim, fobj] = GetFunctionDetails_T2(I,pMax,pMin,gArray,Pc,varrho,n0,r_req)
fobj = @F_T2;
lb = pMin;
ub = pMax;
dim = I;
function objf = F_T2(P)
    diagGArray = reshape(diag(gArray),1,I);
    gamma = P.*diagGArray./(n0 + P*gArray' - P.*diagGArray);
    % penalty method to deal with inequality constraints
    muy = 1e14;     % muy can be taken as 10^13 to 10^15 
    H = (r_req > log2(1 + gamma));
    penalty = muy*sum(H.*((r_req - log2(1 + gamma)).^2));
    % objective function (maximization --> minimization problem)
    objf = -sum(log2(1 + gamma))/sum(Pc + varrho*P) + penalty;
end

end
